package cn.rubintry.animatorutils

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.viewpager.widget.ViewPager

class MainActivity : AppCompatActivity(), View.OnClickListener {

    private var tvTranslation: TextView ?= null
    private var tvScale: TextView ?= null
    private var tvMultiAni: TextView ?= null
    private var tvMultiAniOnSingleView: TextView ?= null

    private var vp : ViewPager ?= null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        tvTranslation = findViewById(R.id.tv_translation)
        tvScale = findViewById(R.id.tv_scale)
        tvMultiAni = findViewById(R.id.tv_multi_ani)
        tvMultiAniOnSingleView = findViewById(R.id.tv_multi_on_single)

        tvTranslation?.setOnClickListener(this)
        tvScale?.setOnClickListener(this)
        tvMultiAni?.setOnClickListener(this)
        tvMultiAniOnSingleView?.setOnClickListener(this)

        vp?.addOnPageChangeListener(object : ViewPager.OnPageChangeListener{
            override fun onPageScrolled(
                position: Int,
                positionOffset: Float,
                positionOffsetPixels: Int
            ) {

            }

            override fun onPageSelected(position: Int) {

            }

            override fun onPageScrollStateChanged(state: Int) {

            }

        })
    }

    override fun onClick(view: View?) {
        when(view?.id){
            R.id.tv_translation -> {
                startActivity(Intent(this , TranslationActivity::class.java))
            }

            R.id.tv_scale -> {
                startActivity(Intent(this , ScaleActivity::class.java))
            }

            R.id.tv_multi_ani -> {
                startActivity(Intent(this , MultiAnimationActivity::class.java))
            }

            R.id.tv_multi_on_single -> {
                startActivity(Intent(this , MultiOnSingleActivity::class.java))
            }
        }
    }
}